<template>
	<view class="page-container">
		<view class="driver">
			<button class="btn" type="warn" @click="checkTicket">扫码验票</button>	
		</view>		
		<view class="order-group-wrapper">
			<view class="order-group-wrapper__item" v-if="orderInfo!=null">				
				<view class="md-block">
					<view class="hd">
						<image class="hd" :src="orderInfo.product.image" mode="aspectFill"></image>
					</view>
					<view class="bd">
						<view class="title">{{orderInfo.product_name}}</view>
						<view class="date">出行日期：{{orderInfo.use_date}}<text class="num">人数：{{orderInfo.num}}</text></view>
						<view class="date">客人信息：{{orderInfo.linkman}}/{{orderInfo.linkphone}}</view>						
						<view class="date">上车地点：{{orderInfo.bycar_place}}</view>
						<view class="date">上车时间：{{orderInfo.bycar_time}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>	
	import {
		apiUrl
	} from '@/api/base.js'
	
	export default {
		components: {
			
		},
		data() {
			return {
				orderInfo:null
			}
		},
		onShow() {
			
		},
		methods: {			
			checkTicket() {				
				var that = this
				that.orderInfo=null;
				uni.scanCode({
					onlyFromCamera: true,
					success: function(res) {						
						uni.request({
							url: apiUrl + "addons/car/order/checkOrder2",
							data: {
								ticketno: res.result							
							},
							method: "GET",
							success: (res) => {
								if (res.data.code) {
									that.orderInfo=res.data.data
									uni.showModal({
										title: '验票成功',
										content: '验票成功,共' + res.data.data.num + '人',
										success: function(res) {
											
										}
									});
								} else {
									uni.showModal({
										title: '验票失败',
										content: res.data.msg,
										success: function(res) {

										}
									});
								}
							},
							fail: (res) => {
								console.log(res)
							}
						})
					}
				})
			}
			
		}
	}
</script>

<style lang="scss">
	.btn{
		border-radius: 15rpx;
		margin: 10rpx;
	}
	.driver{
		background: #e8e8e8;
	}
	.info{
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		justify-content: space-around;
		align-items: center;
	}
	.num{
		margin-left: 20rpx;
	}
	.tdz {
		text-align: center;
	}

	.coupon-view-tab {
		position: fixed;
		
		/* #ifndef H5 */
		top: 0;
		/* #endif */
		left: 0;
		right: 0;
		z-index: 100;
		border-bottom: 2rpx solid $uni-border-color;
		background-color: $uni-bg-color;
	}

	.order-group-wrapper {
		padding: 20rpx 24rpx 20rpx;

		&__item {
			margin-bottom: 20rpx;
			border-radius: 12rpx;
			background: #fff;

			.hd-block {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 20rpx 24rpx;

				.number {
					color: $uni-text-color-grey;
					font-size: 22rpx;
				}

				.state {
					color: $uni-text-color-price;
					font-size: 24rpx;
				}
			}

			.md-block {
				display: -webkit-box;
				padding: 20rpx 24rpx;

				.hd {
					width: 180rpx;
					height: 180rpx;
					position: relative;
					overflow: hidden;
					border-radius: 12rpx;
					background: #e7e7e7;
				}

				.bd {
					-webkit-box-flex: 1;
					margin-left: 24rpx;

					.title {
						height: 40rpx;
						font-size: 28rpx;
						text-overflow: -o-ellipsis-lastline;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						line-clamp: 2;
						-webkit-box-orient: vertical;
					}

					.date,
					.sub {
						color: #999;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
						margin-top: 10rpx;
						font-size: 24rpx;
					}
				}
			}

			.fd-block {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0 24rpx 20rpx;

				.total_price {
					font-size: 28rpx;
					font-family: Arial;
				}

				.btn {
					display: inline-block;
					padding: 6rpx 20rpx;
					margin-right: 10rpx;
					border-radius: 60rpx;
					font-size: 24rpx;

					&:last-child {
						margin-right: 0;
					}

					&.default {
						border: 2rpx solid #d5d5d5;
						background: #fff;
					}
				}
			}
		}
	}

	// 底部独立按钮
	.footer-alone-btn-default {
		text-align: center;
		padding: 0 25rpx 22rpx;
		background: $uni-bg-color-grey;

		.text {
			background: $uni-bg-color-primary;
			padding: 30rpx 0;
			color: $uni-text-color-inverse;
			border-radius: $uni-border-radius-lg;
			font-size: $uni-font-size-base;

			&.disabled {
				background: $uni-bg-color-mask;
			}
		}

		.btn {
			background: $uni-bg-color-primary;
			color: $uni-text-color-inverse;
			border-radius: $uni-border-radius-lg;
			font-size: $uni-font-size-base;

			&.disabled {
				background: $uni-bg-color-mask;
			}

			padding: 15rpx 0;
		}
	}

	.footer-alone-btn-stop {
		text-align: center;
		padding: 0 25rpx 22rpx;
		background: $uni-bg-color-grey;

		.text {
			background: $uni-color-warning;
			padding: 30rpx 0;
			color: $uni-text-color-inverse;
			border-radius: $uni-border-radius-lg;
			font-size: $uni-font-size-base;

			&.disabled {
				background: $uni-bg-color-mask;
			}
		}

		.btn {
			background: $uni-bg-color-primary;
			color: $uni-text-color-inverse;
			border-radius: $uni-border-radius-lg;
			font-size: $uni-font-size-base;

			&.disabled {
				background: $uni-bg-color-mask;
			}

			padding: 15rpx 0;
		}
	}

	.module-block {
		padding: 0 25rpx;
		margin-bottom: 20rpx;
	}

	.info-block {
		border-radius: 15rpx;
		background-color: $uni-bg-color;

		.title {
			height: 88rpx;
			padding: 0 20rpx;
			line-height: 88rpx;
			border-bottom: 1rpx solid $uni-border-color;
			font-size: $uni-font-size-lg;
			font-weight: bold;
		}

		.group {
			padding: 0 20rpx;
			font-size: $uni-font-size-base;
		}

		.group__item {
			border-bottom: 1rpx solid $uni-border-color;

			&:last-child {
				border-bottom: none;
			}
		}
	}

	.traveller-info {

		.title,
		.sub {
			margin-bottom: 20rpx;
			color: #000;
		}

		.title {
			height: auto;
			line-height: normal;
			padding: 24rpx 20rpx 0;
			border-bottom: none;
		}

		.sub {
			padding: 0 20rpx;
			font-size: $uni-font-size-sm;

			.iconfont {
				margin: 0 10rpx 0 6rpx;
				color: $uni-text-color-price;
			}
		}

		.select {
			@extend .displayflex;
			flex-wrap: wrap;
			padding: 20rpx 0 4rpx 20rpx;
			border-top: 1rpx solid $uni-border-color;
			border-bottom: 1rpx solid $uni-border-color;
		}

		.label,
		.more {
			@extend .alignJustify;
			height: 61rpx;
			min-width: 130rpx;
			margin: 0 20rpx 17rpx 0;
			padding: 0 10rpx;
			border-radius: 8rpx;
			border: 2rpx solid #c0eacc;
			font-size: $uni-font-size-base;
			color: $uni-color-primary;

			&.on {
				background-color: $uni-bg-color-primary;
				color: $uni-text-color-inverse;
				border-color: $uni-color-primary;
			}
		}

		.more {
			width: 216rpx;

			.iconfont {
				position: relative;
				top: 2rpx;
			}
		}

		.group__item {
			position: relative;
			padding: 16rpx 0;

			.name {
				margin-bottom: 10rpx;
				color: #000;
			}

			.number {
				font-size: $uni-font-size-sm;
				color: #777;
			}

			.iconfont {
				position: absolute;
				right: -10rpx;
				top: 50%;
				transform: translateY(-50%);
				color: #a0a0a0;
			}
		}
	}

	.linkman-info {
		.group__item {
			@extend .displayflex;
			height: 88rpx;

			&.textarea {
				height: 164rpx;
			}
		}

		.label {
			width: 236rpx;
			line-height: 88rpx;
		}

		.input-text,
		.textarea-text {
			@extend .flex1;
			width: 300rpx;
			height: 100%;
			font-size: $uni-font-size-base;
		}

		.textarea-text {
			padding: 20rpx 0;
			line-height: 36rpx;
			box-sizing: border-box;
		}

		.textarea-box {
			.scroll-area {
				height: 100%;
				overflow-y: auto;
			}
		}

		.input-placeholder {
			line-height: 1.571;
		}
	}

	.input-placeholder {
		color: $uni-text-color-placeholder;
	}
</style>
